﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="../../../Scripts/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>

    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
    <script type="text/javascript">
        var sys_mapExt = null;
        var RE = null;
        var REDtl = null; 
        var fk_mapdata = GetQueryString("FK_MapData"); //表单id.
        var keyOfEn = GetQueryString("KeyOfEn"); //字段

      
        //初始加载
        $(function () {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("RegularExpression_Init");

            data = JSON.parse(data);
            sys_mapExt = data['Sys_MapExt']; // 已经保存的模版.
            for (var j = 0; j < sys_mapExt.length; j++) {
                $("#TB_Doc_" + sys_mapExt[j].Tag).val(sys_mapExt[j].Doc);
                $("#TB_Tag1_" + sys_mapExt[j].Tag).val(sys_mapExt[j].Tag1);
            }

            RE = data['RE']; //模版列表.
            REDtl = data['REDtl']; //模版的详细信息.
            for (var i = 0; i < RE.length; i++) {
                var xh = i + 1;
                var newRow = "<tr><td>" + xh + "</td><td style='bgcolor:red'>" + RE[i].No + "</td><td class=BigDoc><a href=\"javascript:Select('" + RE[i].No + "')\" >" + RE[i].Name + "</a> </td></tr>";
                $("#Table1 tr:last").after(newRow);
            }

        })
        //选择模板
        function Select(id) {

            for (var i = 0; i < REDtl.length; i++) {

                if (REDtl[i].ItemNo != id)
                    continue;

                var ev = REDtl[i].ForEvent;
                var test = $("#TB_Doc_" + ev).val();
                if (test == undefined) {
                    alert("模板没有找到对应事件类型，请手输");
                    continue;
                    // $("#TB_Doc_onblur").val(REDtl[i].Exp);
                    //   $("#TB_Doc_onblur").val(REDtl[i].Msg);
                }

                $("#TB_Doc_" + ev).val(REDtl[i].Exp);
                $("#TB_Tag1_" + ev).val(REDtl[i].Msg);
            }
        }
        //保存
        function Save() {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddUrlData();
            handler.AddFormData();
            var data = handler.DoMethodReturnString("RegularExpression_Save");
            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }
            alert(data);
        }
    </script>
    <style type="text/css">
        .style1
        {
            padding: 4px;
            margin: 4px;
            background-color: #e0ecff;
            font-size: 12px;
            border: 1px solid #ccc;
            text-align: left;
            word-break: keep-all;
            font-weight: bold;
            color: #0e2d5f;
            width: 90px;
        }
        .style2
        {
            width: 90px;
        }
    </style>
</head>
<body>
    <form id="cc">
    <table class='Table' cellpadding='0' cellspacing='0' border='0' style='width: 100%'>
        <caption>
            为字段设置正则表达式.<div style='float: right'>
                <a href='http://ccform.mydoc.io/?v=5769&t=36728' target="_blank">
                    <img src='../../../Img/Help.gif'>正则表达式-帮助</a></div>
        </caption>
        <tr>
            <td class='GroupTitle'>
                序
            </td>
            <td class='style1'>
                事件
            </td>
            <td class='GroupTitle'>
                事件内容
            </td>
            <td class='GroupTitle'>
                提示信息
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                1
            </td>
            <td style='font-size: 12px' class="style2">
                onblur
            </td>
            <td>
                <textarea name="TB_Doc_onblur" rows="1" cols="50" id="TB_Doc_onblur" style="width: 99%;"></textarea>
            </td>
            <td>
                <input name="TB_Tag1_onblur" type="text" value="" size="20" id="TB_Tag1_onblur" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                2
            </td>
            <td style='font-size: 12px' class="style2">
                onchange
            </td>
            <td>
                <textarea name="TB_Doc_onchange" rows="1" cols="50" id="TB_Doc_onchange" style="width: 99%;">
</textarea>
            </td>
            <td>
                <input name="TB_Tag1_onchange" type="text" size="20" id="TB_Tag1_onchange" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                3
            </td>
            <td style='font-size: 12px' class="style2">
                onclick
            </td>
            <td>
                <textarea name="TB_Doc_onclick" rows="1" cols="50" id="TB_Doc_onclick" style="width: 99%;">
</textarea>
            </td>
            <td>
                <input name="TB_Tag1_onclick" type="text" size="20" id="TB_Tag1_onclick" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                4
            </td>
            <td style='font-size: 12px' class="style2">
                ondblclick
            </td>
            <td>
                <textarea name="TB_Doc_ondblclick" rows="1" cols="50" id="TB_Doc_ondblclick" style="width: 99%;">
</textarea>
            </td>
            <td>
                <input name="TB_Tag1_ondblclick" type="text" size="20" id="TB_Tag1_ondblclick" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                5
            </td>
            <td style='font-size: 12px' class="style2">
                onkeypress
            </td>
            <td>
                <textarea name="TB_Doc_onkeypress" rows="1" cols="50" id="TB_Doc_onkeypress" style="width: 99%;">
</textarea>
            </td>
            <td>
                <input name="TB_Tag1_onkeypress" type="text" size="20" id="TB_Tag1_onkeypress" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                6
            </td>
            <td style='font-size: 12px' class="style2">
                onkeyup
            </td>
            <td>
                <textarea name="TB_Doc_onkeyup" rows="1" cols="50" id="TB_Doc_onkeyup" style="width: 99%;">
</textarea>
            </td>
            <td>
                <input name="TB_Tag1_onkeyup" type="text" size="20" id="TB_Tag1_onkeyup" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td class='Idx'>
                7
            </td>
            <td style='font-size: 12px' class="style2">
                onsubmit
            </td>
            <td>
                <textarea name="TB_Doc_onsubmit" rows="1" cols="50" id="TB_Doc_onsubmit" style="width: 99%;">
                </textarea>
            </td>
            <td>
                <input name="TB_Tag1_onsubmit" type="text" value="" size="20" id="TB_Tag1_onsubmit"
                    style="width: 99%;" />
            </td>
        </tr>
    </table>
    <input type="button" id="Btn_Save" name="Btn_Save" value="保存" onclick="Save()" />
    <input type="button" id="Btn_LoadTemplate" name="Btn_LoadTemplate" value="加载模版" onclick="LoadTemplate()" />
    <script type="text/javascript">
        //加载模板
        function LoadTemplate() {
            var Table1 = $("#Btn_LoadTemplate").val();

            if (Table1 == "加载模版") {
                $("#Table1").show();
                $("#Btn_LoadTemplate").val("关闭模板");
            } else {
                $("#Table1").hide();
                $("#Btn_LoadTemplate").val("加载模版");
            }
        }
    </script>
    <div id="div01">
        <table id="Table1" class='Table' cellpadding='0' cellspacing='0' border='0' style="width: 80%;
            display: none">
            <tr>
                <th>序号 </th>
                <th>名称 </th>
                <th>内容 </th>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
